home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / out-of-phase-102-c / OutOfPhase 1.02 Source / OutOfPhase Folder / CompilerRoot.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-23  |  4.8 KB  |  185 lines  |  [TEXT/KAHL]

  1. /* CompilerRoot.h */
  2.  
  3. #ifndef Included_CompilerRoot_h
  4. #define Included_CompilerRoot_h
  5.  
  6. /* CompilerRoot module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* PcodeObject */
  12. /* Memory */
  13. /* CompilerScanner */
  14. /* TrashTracker */
  15. /* CompilerParser */
  16. /* SymbolTable */
  17. /* SymbolTableEntry */
  18. /* ASTExpression */
  19. /* PromotableTypeCheck */
  20. /* SymbolList */
  21. /* CodeCenter */
  22. /* FunctionCode */
  23. /* PeepholeOptimizer */
  24. /* DataMunging */
  25. /* ASTExpressionList */
  26.  
  27. #include "PcodeObject.h"
  28.  
  29. /* forwards */
  30. struct CodeCenterRec;
  31. struct PcodeRec;
  32.  
  33. /* syntactical errors that can occur while compiling */
  34. typedef enum
  35.     {
  36.         eCompileNoError EXECUTE(= -32412),
  37.         eCompileOutOfMemory,
  38.         eCompileExpectedFuncOrProto,
  39.         eCompileExpectedFunc,
  40.         eCompileExpectedIdentifier,
  41.         eCompileExpectedOpenParen,
  42.         eCompileExpectedCloseParen,
  43.         eCompileExpectedColon,
  44.         eCompileExpectedSemicolon,
  45.         eCompileMultiplyDefinedIdentifier,
  46.         eCompileExpectedTypeSpecifier,
  47.         eCompileExpectedExpressionForm,
  48.         eCompileExpectedColonEqual,
  49.         eCompileExpectedTo,
  50.         eCompileExpectedStringLiteral,
  51.         eCompileExpectedResumable,
  52.         eCompileExpectedWhile,
  53.         eCompileExpectedDo,
  54.         eCompileExpectedUntil,
  55.         eCompileExpectedOpenParenOrEqual,
  56.         eCompileExpectedThen,
  57.         eCompileExpectedWhileOrUntil,
  58.         eCompileExpectedCommaOrCloseParen,
  59.         eCompileExpectedElseOrElseIf,
  60.         eCompileExpectedOperatorOrStatement,
  61.         eCompileExpectedOperand,
  62.         eCompileIdentifierNotDeclared,
  63.         eCompileExpectedRightAssociativeOperator,
  64.         eCompileExpectedOpenBracket,
  65.         eCompileExpectedCloseBracket,
  66.         eCompileExpectedVariable,
  67.         eCompileExpectedArrayType,
  68.         eCompileArraySizeSpecMustBeInteger,
  69.         eCompileTypeMismatch,
  70.         eCompileInvalidLValue,
  71.         eCompileOperandsMustBeScalar,
  72.         eCompileOperandsMustBeSequencedScalar,
  73.         eCompileOperandsMustBeIntegers,
  74.         eCompileRightOperandMustBeInteger,
  75.         eCompileArraySubscriptMustBeInteger,
  76.         eCompileArrayRequiredForSubscription,
  77.         eCompileDoubleRequiredForExponentiation,
  78.         eCompileArrayRequiredForResize,
  79.         eCompileIntegerRequiredForResize,
  80.         eCompileConditionalMustBeBoolean,
  81.         eCompileTypeMismatchBetweenThenAndElse,
  82.         eCompileErrorNeedsBooleanArg,
  83.         eCompileFunctionIdentifierRequired,
  84.         eCompileArgumentTypeConflict,
  85.         eCompileWrongNumberOfArgsToFunction,
  86.         eCompileCantHaveStringLiteralThere,
  87.         eCompileMustBeAVariableIdentifier,
  88.         eCompileOperandMustBeBooleanOrInteger,
  89.         eCompileOperandMustBeDouble,
  90.         eCompileArrayRequiredForGetLength,
  91.         eCompileTypeMismatchInAssignment,
  92.         eCompileVoidExpressionIsNotAllowed,
  93.         eCompileMultiplyDeclaredFunction,
  94.         eCompilePrototypeCantBeLastThingInExprList,
  95.         eCompileInputBeyondEndOfFunction,
  96.         eCompileArrayConstructionOnScalarType
  97.     } CompileErrors;
  98.  
  99. /* keywords */
  100. typedef enum
  101.     {
  102.         eKeywordFunc EXECUTE(= -5112),
  103.         eKeywordProto,
  104.         eKeywordVoid,
  105.         eKeywordBool,
  106.         eKeywordInt,
  107.         eKeywordSingle,
  108.         eKeywordDouble,
  109.         eKeywordFixed,
  110.         eKeywordBoolarray,
  111.         eKeywordIntarray,
  112.         eKeywordSinglearray,
  113.         eKeywordDoublearray,
  114.         eKeywordFixedarray,
  115.         eKeywordVar,
  116.         eKeywordIf,
  117.         eKeywordWhile,
  118.         eKeywordDo,
  119.         eKeywordUntil,
  120.         eKeywordSet,
  121.         eKeywordResize,
  122.         eKeywordTo,
  123.         eKeywordError,
  124.         eKeywordResumable,
  125.         eKeywordNot,
  126.         eKeywordSin,
  127.         eKeywordCos,
  128.         eKeywordTan,
  129.         eKeywordAsin,
  130.         eKeywordAcos,
  131.         eKeywordAtan,
  132.         eKeywordLn,
  133.         eKeywordExp,
  134.         eKeywordSqr,
  135.         eKeywordSqrt,
  136.         eKeywordAbs,
  137.         eKeywordNeg,
  138.         eKeywordSign,
  139.         eKeywordLength,
  140.         eKeywordPi,
  141.         eKeywordTrue,
  142.         eKeywordFalse,
  143.         eKeywordThen,
  144.         eKeywordElse,
  145.         eKeywordElseif,
  146.         eKeywordAnd,
  147.         eKeywordOr,
  148.         eKeywordXor,
  149.         eKeywordDiv,
  150.         eKeywordMod,
  151.         eKeywordGetsampleleft,
  152.         eKeywordGetsampleright,
  153.         eKeywordGetsample,
  154.         eKeywordGetwavenumframes,
  155.         eKeywordGetwavenumtables,
  156.         eKeywordGetwavedata
  157.     } KeywordsType;
  158.  
  159. /* this function is used for specifying information about a parameter */
  160. typedef struct
  161.     {
  162.         char*                        ParameterName;
  163.         DataTypes                ParameterType;
  164.     } FunctionParamRec;
  165.  
  166. /* compile a module.  a module is a text block with a series of function definitions. */
  167. /* if compilation succeeds, the functions are added to the CodeCenter object. */
  168. /* the text data is NOT altered. */
  169. CompileErrors            CompileModule(long* ErrorLineNumber, char* TextData, void* Signature,
  170.                                         struct CodeCenterRec* CodeCenter);
  171.  
  172. /* return a null terminated static string describing the error. */
  173. char*                            GetCompileErrorString(CompileErrors Error);
  174.  
  175. /* compile a special function.  a special function has no function header, but is */
  176. /* simply some code to be executed.  the parameters the code is expecting are provided */
  177. /* in the FuncArray[] and NumParams.  the first parameter is deepest beneath the */
  178. /* top of stack.  the TextData is NOT altered.  if an error occurrs, *FunctionOut */
  179. /* will NOT contain a valid object */
  180. CompileErrors            CompileSpecialFunction(FunctionParamRec FuncArray[], long NumParams,
  181.                                         long* ErrorLineNumber, DataTypes* ReturnType, char* TextData,
  182.                                         struct PcodeRec** FunctionOut);
  183.  
  184. #endif
  185.